home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr11
/
vol12no2.zip
/
NEWOBJ.ZIP
/
NEWOBJ.FRG
next >
Wrap
Text File
|
1992-01-05
|
1KB
|
43 lines
TYPE
CardValueType = RECORD
Suit : SuitType; { An enumeration of Clubs...Spades }
Spot : SpotType; { An enumeration of Ace..King }
END; { CardValueType }
CardType = object(TObject)
:
:
constructor Init(var CardValue : CardValueType);
:
:
end; { CardType }
CONSTRUCTOR DeckType.Init(NumDecks : Byte;
CardKind : Pointer;
CardCons : Pointer);
VAR
I, L : Word;
J : SpotType;
K : SuitType;
Card : CardValueType;
BEGIN
L := 0;
FOR I := 1 TO NumDecks DO
FOR K := Clubs TO Spades DO
FOR J := Ace TO King DO
BEGIN
Inc(L);
Card.Spot := J; { Setup the values to be passed }
Card.Suit := K; { to the constructor }
{ Create a new instance of the descendant card type }
Cards[L] := CardTypePtr(NewByType(CardKind,
CardCons,
Card));
END;
END;
{In a different unit, or the main program...}
MyDeck.Init(8,TypeOf(WindowCards),@WindowCards.Init);